package com.daqian.chance.core.enums;


import cn.hutool.http.HttpStatus;

/**
 * @Author: daqian
 * @Date: 2019/2/12 17:10
 */
public enum ErrorCode {

    /**
     * 成功
     */
    OK(0, "成功"),
    /**
     * 普通异常
     */
    ERR(-1, "未知异常"),

    /**
     * 未注册
     */
    UNREGISTERED(1001, "请先注册"),


    /**
     * 请求参数数据类型不匹配
     */
    BAD_REQUEST(HttpStatus.HTTP_BAD_REQUEST, "请求参数数据类型不匹配"),

    /**
     * 未授权 401
     */
    UNAUTHORIZED(HttpStatus.HTTP_UNAUTHORIZED, "未授权");

    private int code;
    private String msg;

    ErrorCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int code() {
        return this.code;
    }

    public String msg() {
        return this.msg;
    }


}
